package beans;

import java.util.ArrayList;
import java.util.List;

public class BacklogViewBean {
	private List<BacklogItemBean> backlogList;
	
	public BacklogViewBean() {
		backlogList = new ArrayList<BacklogItemBean>();
	}
	
	public void addRow(BacklogItemBean backlogItemBean) {
		backlogList.add(backlogItemBean);
	}
	
	public String getJson() {
		StringBuffer sb = new StringBuffer();

		sb.append("{ ");
		sb.append("\"row\": [");
		for (int i = 0; i < backlogList.size(); i++) {
			
			BacklogItemBean backlogItemBean = backlogList.get(i);
			sb.append(backlogItemBean.getJson());
			
			if (i != backlogList.size() - 1) {
				sb.append(",");
			}
		}
		sb.append("]");
		sb.append("}");
					
		return sb.toString();
	}

}
